.TH SASH 1
.SH NAME
sash \- stand-alone shell with built-in commands
.SH SYNOPSIS
.B sash
.SH DESCRIPTION
The
.B sash
program is a stand-alone shell which is useful for recovering from certain
types of system failures.  In particular, it was created in order to cope
with the problem of missing shared libraries.
You can also use
.B sash
to safely upgrade to new versions of the shared libraries.
.PP
.B Sash
can execute external programs, as in any shell.  There are no restrictions
on these commands, as the standard shell is used to execute them if there
are any meta-characters in the command.
.PP
More importantly, however, is that many of the standard system commands
are built-in to
.BR sash .
These built-in commands are:
.PP
.nf
     chgrp, chmod, chown, cmp, cp, dd, echo,
     ed, grep, kill, ln, ls, mkdir, mknod,
     more, mount, mv, printenv, pwd, rm, rmdir,
     sync, tar, touch, umount
.fi
.PP
These commands are generally similar to the standard programs with similar
names.  However, they are simpler and cruder than the external programs,
and so many of the options are not implemented.  The restrictions for each
built-in command are described later.
.PP
The built-in commands which correspond to external programs begin with a
dash character in order to distinguish them from the external programs.
So typing "ls", for example, will attempt to run the real
.B ls
program.
If "-ls" is typed, then the built-in command which mimics
.B ls
is called.
.PP
For the built-in commands, filenames are expanded so that asterisks,
question marks, and characters inside of square brackets are recognised
and are expanded.  However, no other command line processing is performed.
This includes quoting of arguments, specifying of file redirection, and
the specifying of a pipeline.
.PP
If an external program is non-existent or fails to run correctly, then
the "alias" built-in command may be used to redefine the standard command
so that it automatically runs the built-in command instead.  For example,
the command "alias ls -ls" redefines "ls" to run the built-in command.
This saves you the pain of having to remember to type the leading dash
all of the time.
.PP
The "help" command will list all of the built-in commands in
.B sash .
Each built-in command is described below in more detail.
.PP
.TP
.B alias [name [command]]
If
.I name
and
.I command
are provided, this defines an alias for a command
with the specified name, which executes the specified command, with
possible arguments.  If just
.I name
is provided, then the definition
of the specified command alias is displayed.  If nothing is provided,
then the definitions of all aliases are displayed.  When defining an
alias, wildcards are not expanded.
.TP
.B cd [dirname]
If
.I dirname
is provided, then the current directory is changed to the
dirname.  If
.I dirname
is absent, then the current directory is changed
to the user's home directory (value of the $HOME environment variable).
.TP
.B chgrp gid filename ...
Change the group id for the specified list of files.  The
.I gid
can
either be a group name, or a decimal value.
.TP
.B chmod mode filename ...
Change the mode of the specified list of files.  The
.I mode
argument
can only be an octal value.
.TP
.B chown uid filename ...
Change the owner id for the specified list of files.  The
.I uid
can
either be a user name, or a decimal value.
.TP
.B cmp filename1 filename2
Determines whether or not the specified filenames have identical data.
This says that the files are links to each other, are different sizes,
differ at a particular byte number, or are identical.
.TP
.B cp srcname ... destname
Copies one or more files from the
.I srcname
to the
.IR destname .
If more
than one srcname is given, or if destname is a directory, then all
the srcnames are copied into the destname directory with the same
names as the srcnames.
.TP
.B dd if=name of=name [bs=n] [count=n] [skip=n] [seek=n]
Copy data from one file to another with the specified parameters.
The
.I if
and
.I of
arguments must be provided, so stdin and stdout cannot
be specified.  The
.I bs
argument is the block size, and is a numeric
value (which defaults to 512 bytes).
.I Count
is the number of blocks
to be copied (which defaults to end of file for the input file).
.I Skip
is the number of blocks to ignore before copying (seek is used
if possible, and the default is 0).
.I Seek
is the number of blocks to
seek in the output file before writing (and defaults to 0).  Any of
the numeric decimal values can have one or more trailing letters
from the set 'kbw', which multiplies the value by 1024, 512, and 2
respectively.  The command reports the number of full blocks read
and written, and whether or not any partial block was read or written.
.TP
.B echo [args] ...
Echo the arguments to the -echo command.  Wildcards are expanded, so
this is convenient to get a quick list of filenames in a directory.
The output is always terminated with a newline.
.TP
.B ed [filename]
Edit the specified file using line-mode commands.  The following
.B ed
commands are provided: = c r w i a d p l s f k z and q.
Line numbers can be constants, ".", "$", "'x", 
.RI / string /
and simple
arithmetic combinations of these.  The substitute command and the
search expression can only use literal strings.  There are some
small differences in the way that some commands behave.
.TP
.B exec filename [args]
Execute the specified program with the specified arguments.
This replaces
.B sash
completely by the executed program.
.TP
.B exit
Quit from
.BR sash .
.TP
.B grep [-in] word filename ...
Display lines of the specified files which contain the given word.
If only one filename is given, then only the matching lines are
printed.  If multiple filenames are given, then the filenames are
printed along with the matching lines.
.I Word
must be a single word,
(ie, not a regular expression).  If -i is given, then case is
ignored when doing the search.  If -n is given, then the line
numbers of the matching lines are also printed.
.TP
.B help
Displays a list of built-in commands.
.TP
.B kill [-signal] pid ...
Sends the specified signal to the specified list of processes.
.I Signal
is a numberic value, or one of the special values HUP, INT,
QUIT, or KILL.
.TP
.B ln [-s] srcname ... destname
Links one or more files from the
.I srcname
to the specified
.IR destname .
If there are
multiple srcnames, or destname is a directory, then the link is
put in the destname directory with the same name as the source name.
The default links are hard links.  Using -s makes symbolic links.
For symbolic links, only one srcname can be specified.
.TP
.B ls [-lid] filename ...
Display information about the specified filenames, which may be
directories.  The normal listing is simply a list of filenames,
one per line.  The options available are -l, -i, and -d.  The -l
option produces a long listing given the normal 'ls' information.
The -i option also displays the inode numbers of the files.  The
-d option displays information about a directory, instead of the
files within it.
.TP
.B mkdir dirname ...
Creates the specified directories.  They are created with the
default permissions.
.TP
.B mknod filename type major minor
Creates a special device node, either a character file or a block
file.
.I Filename
is the name of the node.
.I Type
is either 'c' or 'd'.
.I Major
is the major device number.
.I Minor
is the minor device number.
Both of these numbers are decimal.
.TP
.B more filename ...
Type out the contents of the specified filenames, one page at a
time.  For each page displayed, you can type 'n' and a return to go
to the next file, 'q' and a return to quit the command completely,
or just a return to go to the next page.
.TP
.B mount [-t type] devname dirname
Mount a filesystem on a directory name.  The -t option specifies the
type of filesystem being mounted, and defaults to "minix".
.TP
.B mv srcname ... destname
Moves one or more files from the
.I srcname
to the
.IR destname .
If multiple srcnames are given, or if destname is a directory, then
the srcnames are copied into the destination directory with the
same names as the srcnames.  Renames are attempted first, but if
this fails because of the files being on different filesystems,
then a copies and deletes are done instead.
.TP
.B printenv [name]
If
.I name
is not given, this prints out the values of all the current
environment variables.  If
.I name
is given, then only that environment variable value is printed.
.TP
.B prompt [word] ...
Sets the prompt string that is displayed before reading of a
command.  A space is always added to the specified prompt.
.TP
.B pwd
Prints the current working directory.
.TP
.B quit
Exits from
.BR sash .
.TP
.B rm filename ...
Removes one or more files.
.TP
.B rmdir dirname ...
Removes one or more directories.  The directories must be empty
for this to be successful.
.TP
.B setenv name value
Set the value of an environment variable.
.TP
.B source filename
Execute commands which are contained in the specified filename.
.TP
.B sync
Do a "sync" system call to force dirty blocks out to the disk.
.TP
.B tar [xtv]f devname [filename] ...
List or restore files from a tar archive.  This command can only
read tar files, not create them.  The available options are xtvf.
The f option must be specified, and accepts a device or file
name argument which contains the tar archive.  If no filename is
given, all files in the archive are listed or extracted.  Otherwise,
only those files starting with the specified filenames are done.
Leading slashes in the tar archive filenames are removed.
.TP
.B touch filename ...
Updates the modify times of the specified files.  If a file does not
exist, then it will be created with the default protection.
.TP
.B umask [mask]
If
.I mask
is given, sets the "umask" value used for initializing the
permissions of newly created files.  If
.I mask
is not given, then the
current umask value is printed.  The mask is an octal value.
.TP
.B umount filename
Unmounts a file system.  The filename can either be the device name
which is mounted, or else the directory name which the file system
is mounted onto.
.TP
.B unalias name
Remove the definition for the specified alias.
.SH WARNINGS
Several other system commands might be necessary for system recovery,
but aren't built-in to
.BR sash .
Among these are
.B uncompress
and
.BR fsck .
.SH AUTHOR
David I. Bell
